WPS 加载项开发 > 表格 API 参考 > PivotField > 方法 > PivotField.AddPageItem 方法
向具有多个项的页面字段添加其他项。

语法

表达式.AddPageItem(Item, ClearList)

表达式   一个代表 PivotField 对象的变量。

参数

名称 必选/可选 数据类型 说明
Item 必选 String PivotItem 对象的源名称,该名称与特定的联机分析处理 (OLAP)?(OLAP:为查询和报表(而不是处理事务)而进行了优化的数据库技术。OLAP 数据是按分级结构组织的,它存储在多维数据集而不是表中。) 成员的唯一名称相对应。
ClearList 可选 Variant 如果为 False(默认值),则向现有列表中添加一个页面项。如果为 True,则删除所有当前项,然后添加 Item

说明

为了避免运行时错误,数据源必须是 OLAP 源,选择的字段当前必须位于页面位置中,并且 EnableMultiplePageItems 属性必须设置为 True

示例

在本例中,ET 添加一个源名称为“[Product].[All Products].[Food].[Eggs]”的页面项。本示例假定 OLAP 数据透视表位于活动工作表上。

示例代码
function UseAddPageItem() {

    // The source is an OLAP database and you can manually reorder items.
    ActiveSheet.PivotTables(1).CubeFields.Item("[Product]"). EnableMultiplePageItems = true
								
    // Add the page item titled "[Product].[All Products].[Food].[Eggs]".
    ActiveSheet.PivotTables(1).PivotFields("[Product]").AddPageItem ("[Product].[All Products].[Food].[Eggs]")
								
}


请参阅